BioInfo - Exercices Bash
BioInfo - Exercices Bash
contact : ludwig@univ-brest.fr
Preparation
cd
cp /home/tludwig/s.omalleysbar.txt .
bashA. Get the first word from each line (easy)
use cut
cat s.omalleysbar.txt | ... | head -30
bashSolution
Code
B. Sort first word from each line by number of occurrences (medium)
use cut, sort, uniq
cat s.omalleysbar.txt | ... | head -20
bashSolution
Code
C. Get the last word from each line (hard)
use cut, rev
cat s.omalleysbar.txt | ... | head -20
bashSolution
Code
D. Get all the line containing "as" (easy)
use grep -w
cat s.omalleysbar.txt | ...
bashSolution
Code
E. Get the number of occurrences of "as" (medium)
use grep, wc
cat s.omalleysbar.txt | ...
bashSolution
Code
F. Sort all words alphabetically (medium)
use tr, sort
cat s.omalleysbar.txt | tr '[:upper:]' '[:lower:]' | ... | head -30
Solution
G. Sort all words by number of occurrences (medium-hard)
use tr, sort, uniq
cat s.omalleysbar.txt | tr '[:upper:]' '[:lower:]' | ... | head -30
bash Solution
Code
H. Get all lines with more than 45 characters (hard)
use cut, diff, grep
cat s.omalleysbar.txt | ...
...
bash Solution
Code